import {BOOKS,UPDATE_PV} from '../actions/beforepage.action';

const initBooks = [];
export default function BeforeBooks(state=initBooks,action){
	switch(action.type) {
		case UPDATE_PV:
			state.forEach(bk=>{
				if (bk.id===action.data.id) {
					bk.pv=action.data.pv
				};
			});
			return [...state];
		case BOOKS:
			return action.books;
		default:
			return state;
	}
}